/*****************************************************************************/
/* HLLibPort.h                               Copyright (c) cmd.exe 2014-201x */
/*---------------------------------------------------------------------------*/
/* Portability module for the HLLib library. Contains a wrapper symbols to   */
/* make the compilation under Win, Lin, Mac                                  */
/* Author: Ryan Gregg ( Nem's Tools )                                        */
/* System: Windows                                                           */
/*                                                                           */
/* Author: who                                                               */
/* System: Linux x.x.x                                                       */
/*                                                                           */
/* Author: Who                                                               */
/* System: Mac OS X                                                          */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*   Date    Ver   Who  Comment                                              */
/* --------  ----  ---  -------                                              */
/* 01.06.14  1.00  Cmd  Created                                              */
/*****************************************************************************/

#ifdef _MSC_VER
	typedef unsigned __int8		hlUInt8;
	typedef unsigned __int16	hlUInt16;
	typedef unsigned __int32	hlUInt32;
	typedef unsigned __int64	hlUInt64;
#else
#	include <stdint.h>

	typedef uint8_t		hlUInt8;
	typedef uint16_t	hlUInt16;
	typedef uint32_t	hlUInt32;
	typedef uint64_t	hlUInt64;
#endif

#define NOMINMAX

#if _MSC_VER
#	define _CRT_SECURE_NO_WARNINGS
#	define _CRT_NONSTDC_NO_DEPRECATE
#endif

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#define strcat strcat_s
#else
#	define stricmp strcasecmp
#	define _strnicmp strncasecmp
#	include <errno.h>
#	include <sys/types.h>
#	include <sys/stat.h>
#	include <sys/mman.h>
#	include <unistd.h>
#	include <fcntl.h>

#	ifndef O_BINARY
#		define O_BINARY 0
#	endif

#	ifndef O_RANDOM
#		define O_RANDOM 0
#	endif

	// http://www.gamedev.net/reference/articles/article1966.asp
	typedef struct tagBITMAPINFOHEADER
	{
		unsigned int	biSize;
		unsigned long	biWidth;
		unsigned long	biHeight;
		unsigned short	biPlanes;
		unsigned short	biBitCount;
		unsigned int	biCompression;
		unsigned int	biSizeImage;
		unsigned long	biXPelsPerMeter;
		unsigned long	biYPelsPerMeter;
		unsigned int	biClrUsed;
		unsigned int	biClrImportant;
	} BITMAPINFOHEADER;

	typedef struct tagBITMAPFILEHEADER
	{ 
		unsigned short	bfType;
		unsigned int	bfSize;
		unsigned short	bfReserved1;
		unsigned short	bfReserved2;
		unsigned int	bfOffBits;
	} BITMAPFILEHEADER;

	typedef struct tagRGBQUAD
	{
		unsigned char	rgbBlue;
		unsigned char	rgbGreen;
		unsigned char	rgbRed;
		unsigned char	rgbReserved;
	} RGBQUAD;
#endif

#include <assert.h>
#include <ctype.h>
#include <memory.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include <algorithm>
#include <list>
#include <vector>

#ifdef _WIN32
#	define PATH_SEPARATOR_CHAR '\\'
#	define PATH_SEPARATOR_STRING "\\"
#else
#	define PATH_SEPARATOR_CHAR '/'
#	define PATH_SEPARATOR_STRING "/"
#endif // _WIN32